
$('#refresh').click(function(){
	window.location.reload();
});
//浏览器信息
//var userAgent = navigator.userAgent.toLowerCase(); 
//alert(userAgent);

function getQueryString(name){ 
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
	var r = window.location.search.substr(1).match(reg); 
	if (r != null) return unescape(r[2]); return null; 
}

function getLocation(){
	var str = window.location.href;
	var reg = str.split('&');
	for(i=0;i<reg.length;i++){
		if(reg[i].indexOf('location=')>=0){
			return reg[i].substr('9');
		}
	}
	return false;
}
/*if(getQueryString('openId')){localStorage.openId = getQueryString('openId');}
if(getQueryString('lat')){localStorage.latitude = getQueryString('lat');}
if(getQueryString('lnt')){localStorage.longitude = getQueryString('lnt');}
if(getLocation()){
	localStorage.locat = decodeURI(getLocation());
	//alert(localStorage.locat);
	//alert(getQueryString('location'));
	//alert(decodeURI(getQueryString('location')));
}*/

if(localStorage.fileName == 'order'){
	//alert(getQueryString('openId')); 抛出
}

//alert( $.inArray(1,Array(1,2,3))); 0,1或-1

if(!localStorage.lastUrl)localStorage.lastUrl = 'service';

function checkLogin(rspCd){
	if(rspCd=='9997' || rspCd=='5550'){
		localStorage.lastUrl = localStorage.fileName;
		Turl('account');
	}
}

function Msg(sContent,sType){// type 1:成功 2:提醒 3:错误
	var sTime = 3000;
	var tips_box = '';
	var tips_info ='<div class="info"></div>';
	var tips_type;
	var randId = Math.ceil(Math.random()*100000);
	var objId = 'tipBox_'+randId;
	switch(sType) {
		case 1:
			tips_box = tips_box + '<div class="tips_box success_bg tips_shadow" id="'+objId+'"></div>';
			tips_type = '<i class="ppx_icon success"></i>';
			break;
		case 2:
			tips_box = tips_box + '<div class="tips_box tips_bg tips_shadow" id="'+objId+'"></div>';
			tips_type = '<i class="ppx_icon tips"></i>';
			break;
		case 3:
			tips_box = tips_box + '<div class="tips_box error_bg tips_shadow" id="'+objId+'"></div>';
			tips_type = '<i class="ppx_icon error"></i>';
			break;	
		default:
			tips_box = tips_box + '<div class="tips_box tips_bg tips_shadow" id="'+objId+'"></div>';
			tips_type = '<i class="ppx_icon tips"></i>';
			break;											
	}
	var tips_txt = '<p class="txt">'+sContent+'</p>';
	
	if($(".tips_box").length==0){
		$("body").append(tips_box);
		$("#"+objId).append(tips_info);
		$(".info").append(tips_type).append(tips_txt);
	}

	$('.tips_box').css({left:parseInt(($('body').width()-$('.tips_box').width())/2)-20,top:parseInt(($(window).height()-$('.tips_box').height())/2)-20}).show();
	
	setTimeout(function(){$("#"+objId).remove()},sTime);
	
	$(window).resize(function(){
		$('.tips_box').css({left:parseInt(($('body').width()-$('.tips_box').width())/2),top:parseInt(($(window).height()-$('.tips_box').height())/2)}).show();
	});
}

function Turl(page){//页面跳转
	window.location = page+'.php';
}

function TurlStr(page,str){
	window.location = page+'.php?'+str;
}

Array.prototype.unique = function(){
	var n = {},r=[];
	for(var i = 0; i < this.length; i++)
	{
		if (this[i] && !n[this[i]])
		{
			n[this[i]] = true;
			r.push(this[i]);
		}
	}
	return r;
}

function checkTel(tel){
	var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
	if(reg.test(tel)){
		return true;
	}else{
		return false;
	}
}

function checkAccount(str){//暂时没用
	var pattern = /^[\w\u4e00-\u9fa5]+$/gi;
	if(pattern.test(str)){
		return false;
	}
	return true;
}

localStorage.pageHeight = $(window).height();

function showLoading(){
	hideLoading();
	var loadIngBox = '<div class="loadIngBox"></div>';
	var loadBg     = '<div class="bg"></div>';
	var loadImg    = '<div class="spinner"><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div></div>';
	$('body').append(loadIngBox);
	$('.loadIngBox').append(loadBg);
	$('.loadIngBox').append(loadImg);
	//if(localStorage.fileName=='order_submit'){
		//$('.loadIngBox .spinner').css("margin-top",'200px');
	//}else{
		$('.loadIngBox .spinner').css("margin-top",(localStorage.pageHeight-60)/2+'px');
	//}
}

function hideLoading(){
	$('.loadIngBox').remove();
}

$(document).bind("selectstart",function(){return false;});//禁止选择文本